<template>
  <el-input v-model="form.account" placeholder="Please input" />
  <el-input
      v-model="form.password"
      type="password"
      placeholder="Please input password"
      show-password
  />
  <div>
    <el-button type="primary" @click="login">登录</el-button>
  </div>
</template>



<script lang="ts" setup>

import {reactive, ref} from 'vue'
import {LoginControllerService, LoginDto} from "../../generated";
import router from "@/router";
const input = ref('')
const form = reactive({
  account: "",
  password: "",
} as LoginDto);

const login = async () => {
  const res = await LoginControllerService.loginUsingPost(form);
  // 登录成功，跳转到主页
  if (res.code === 200) {
    await router.push({
      path: "/about",
      replace: true,
    });
  } else {
    alert("失败")
  }
};

</script>



<style>

</style>

